<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('打款数据列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">订单编号：</label>
                                <input type="text" name="id"/>
                            </li>
                            <li>
                                <label style="width: 100px;">结算人名：</label>
                                <input type="text" name="screenName"/>
                            </li>
                            <li>
                                <label style="width: 100px;">结算卡号：</label>
                                <input type="text" name="screenNum" placeholder="精确搜索"/>
                            </li>
                            <li>
                                <label style="width: 100px;">出款状态：</label>
                                <select name="settleState">
                                    <option value="">所有</option>
                                    <option value="-1">已上送</option>
                                    <option value="0">待处理</option>
                                    <option value="1">出款成功</option>
                                    <option value="-2">出款失败</option>
                                    <option value="-3">出款冻结</option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 100px;">出款流水号：</label>
                                <input type="text" name="settleSerial"/>
                            </li>
                            <li>
                                <label style="width: 100px;">商户编号：</label>
                                <input type="text" name="merno"/>
                            </li>
                            <li>
                                <label style="width: 100px;">上游商户编号：</label>
                                <input type="text" name="ldMerno"/>
                            </li>
                            <li>
                                <label style="width: 100px;">服务商编号：</label>
                                <input type="text" name="agentNo"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px;">出款日期：</label>
                                <input type="text" readonly class="time-input" id="startTime" placeholder="开始日期" name="params[beginAddTime]"/>
                                <span>-</span>
                                <input type="text" readonly class="time-input" id="endTime" placeholder="结束日期" name="params[endAddTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <!--<div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success single disabled" onclick="updateBank()" shiro:hasPermission="merchantInfo:merchantInfo:updateBank">
                    <i class="fa fa-edit"></i> 修改结算信息
                </a>
                <a class="btn btn-success" onclick="queryUnknown()" shiro:hasPermission="merchantInfo:merchantInfo:updateBank">
                    <i class="fa fa-edit"></i> 发起未知查询
                </a>
                <a class="btn btn-success" onclick="errorAgain()" shiro:hasPermission="merchantInfo:merchantInfo:updateBank">
                    <i class="fa fa-edit"></i> 重新出款
                </a>
            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('merPaid:merPaid:edit')}]];
        var removeFlag = [[${@permission.hasPermi('merPaid:merPaid:remove')}]];
        var prefix = ctx + "merPaid/merPaid";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "打款数据",
                clickToSelect:true,
                columns: [{
                    radio: true
                },
                {
                    field: 'merName',
                    title: '商户名称'
                },
                {
                    field: 'ldMerno',
                    title: '上游商户名称'
                },
                {
                    field: 'agentNo',
                    title: '服务商编号'
                },
                {
                    field: 'agentName',
                    title: '服务商名称'
                },
                {
                    field: 'merno',
                    title: '商户编号'
                },
                {
                    field: 'id',
                    title: '订单编号'
                },

                {
                    field: 'bankName',
                    title: '开户行名称',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,5);
                    }
                },
                {
                    field: 'show_screennum',
                    title: '交易卡号'
                },
                {
                    field: 'accounts.screenName',
                    title: '结算人'
                },
                {
                    field: 'screenNum',
                    title: '结算卡'
                },
                {
                    field: 'tmoney',
                    title: '结算金额',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'amount',
                    title: '总交易金额',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'charge',
                    title: '总手续费',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'counts',
                    title: '总笔数'
                },
                {
                    field: 'auditdate',
                    title: '出款日期'
                },
                {
                    field: 'settleState',
                    title: '出款状态',
                    formatter: function(value, row, index) {
                        if ("0"==value){
                            return '<span style="color:blue;">待处理</span>';
                        }else if("1"==value){
                            return '<span style="color:green;">出款成功</span>';
                        }else if("-2"==value){
                            return '<span style="color:red;">出款失败</span>';
                        }else if("-3"==value){
                            return ' <span style="color:red;">冻结</span>';
                        }else if("-1"==value){
                            return ' <span style="color:green;">已上送</span>';
                        }else{
                            return ' <span style="color:red;">出款失败</span>';
                        }
                    }
                },
                {
                    field: 'settleSerial',
                    title: '出款流水号'
                },
                {
                    field: 'settleType',
                    title: '出款类型',
                    formatter: function (value, row, index) {
                        if ("00" == value) {
                            return ' <span style="color:red;">商户</span>';
                        } else if ("01" == value) {
                            return ' <span style="color:green;">服务商</span>';
                        }
                    }
                },

                {
                    field: 'remarks',
                    title: '备注',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,3);
                    }
                }
                ]
            };
            $.table.init(options);
        });

       /* /!**
         * 修改结算
         *!/
        function updateBank() {
            var settleState = $.table.selectColumns("settleState");
            var settleSerial = $.table.selectColumns("settleSerial");
            if ($.common.isEmpty(settleState)) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            if (settleState != '-2'){
                $.modal.alertWarning("出款失败才可修改结算信息");
                return;
            }
            $.modal.open("修改结算信息",prefix + "/updateBank/" + settleSerial,'1200','600');
        }

        /!**
         * 发起未知查询
         *!/
        function queryUnknown() {
            $.modal.confirm("确认发起未知查询?", function() {
                $.operate.submit(prefix + "/queryUnknown", "post", "json");
            });
        }


        /!**
         * 重新出款
         *!/
        function errorAgain() {
            $.modal.confirm("确认重新出款?", function() {
                $.operate.submit(prefix + "/errorAgain", "post", "json");
            });
        }*/


    </script>
</body>
</html>